{% extends 'index.html' %}
{% load stu_tags %}
{% block page-content %}
<h2>我的课程</h2>
<hr>
<div class="panel panel-default">
    <div class="panel-heading">课程列表</div>
    <div class="panel-body">
        <table class="table table-hover">
            <thead>
            <tr>
                <th>课程名称</th>
                <th>班级</th>
                <th>开课日期</th>
                <th>结业日期</th>
                <th>课程进度</th>
                <th>我的成绩</th>
                <th>作业管理</th>
            </tr>
            </thead>
            <tbody>
            {% for enroll_obj  in request.user.stu_account.enrollment_set.all %}
            <tr>
                <td>{{ enroll_obj.enrolled_class.course }}</td>
                <td>{{ enroll_obj.enrolled_class.semester }}期</td>
                <td>{{ enroll_obj.enrolled_class.start_date }}</td>
                <td>{{ enroll_obj.enrolled_class.end_date }}</td>
                <td>{{ enroll_obj.enrolled_class.courserecord_set.all.count }}节</td>
                <td>{% get_score enroll_obj request.user.stu_account as score_data %}
                    {{ score_data.score__sum}}
                </td>
                <td><a href="{% url 'studyrecords' enroll_obj.id %}">作业管理</a></td>
            </tr>
            {% endfor %}
            </tbody>
        </table>
    </div>


</div>
{% endblock %}